<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //遍历数组，是把数组中的元素从头到尾访问以此
        var arr =['red','green','blue'];
        for(var i = 0;i<3;i++){
            console.log(arr[i]);
        }
        //1.数组索引号从0开始，所以i必须从0开始，i<3;
        //2.输出时候arr[i] i计数器当索引号用
    </script>
</head>
<body>
    
</body>
</html>